package main

import (
	"goapp-web-server/app"
	"goapp-web-server/app/middleware/casbin"
	"goapp-web-server/app/middleware/cors"
	"goapp-web-server/app/middleware/jwt"
	"goapp-web-server/app/middleware/robot"
	"goapp-web-server/app/router"
	"goapp-web-server/app/utils/orm"

	"github.com/kataras/iris"
)

func main() {
	app := app.App()
	// robot
	app.Configure(robot.Configurator)
	// csrf
	// app.Configure(csrf.Configurator)
	// cors
	app.Configure(cors.Configurator)
	// jwt
	app.Configure(jwt.Configurator)
	// casbin
	app.Configure(casbin.Configurator)
	// router
	app.Configure(router.Configurator)
	// database connection
	orm.Connect()
	// orm.AutoMigrate()
	// run
	app.Run(iris.Addr(":8080"), iris.WithoutServerError(iris.ErrServerClosed))
}
